Demote instruction for relinquishing cache line ownership

ABSTRACT

A computer system processor of a multi-processor computer system having cache subsystem, executes a demote instruction to cause a cache line exclusively owned by the computer system processor to become shared or read-only in the cache subsystem.

TRADEMARKS

IBM® is a registered trademark of International Business MachinesCorporation, Armonk, N.Y., U.S.A. Other names used herein may beregistered trademarks, trademarks or product names of InternationalBusiness Machines Corporation or other companies.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates to computer systems and in particular to systemswith cache subsystems wherein demote requests are performed by the cachesubsystem and which allows software to indicate to hardware that itshould alter its cache state.

2. Description of Background

In a multiprocessing system where consistent memory usage model isrequired, memory usage among different central processors (CPs) ismanaged using cache coherency ownership schemes. These schemes usuallyinvolve various ownership states for a cache line. These states includeread-only (or commonly known as shared), and exclusive (where a certainprocessor has the sole and explicit update rights to the cache line,sometimes known as store access).

For one such protocol used for a strongly-ordered memory consistencymodel, as in IBM's z/Architecture implemented by IBM System zprocessors, when a processor is requesting rights to update a line, e.g.when it is executing a “Store” instruction, it will check its localcache (L1) for the line's ownership state. If the processor finds outthat the line is either currently shared or is not in its cache at all,it will then send an “exclusive ownership request” to the storagecontroller (SC) which serves as a central coherency manager.

The storage controller (SC) tracks which processor, if any, currentlyowns a line exclusively. If deemed necessary, the storage controller(SC) will then send a “cross interrogate” (XI) or “ownership change”request to another processor which currently owns that line to releaseits exclusive rights. Once the current owning processor has responded tothe XI and responded that the exclusive ownership is released, therequesting processor will then be given exclusive update rights to theline requested.

In a large SMP (Symmetric Multi-Processing) system, it is common thatvarious processes running on different processors update the same cachelines, but at different times. When a line is updated by one process,and then another process starts up, updating the same line by that otherprocess will encounter delays required for XI acknowledgement whileexchanging exclusive ownerships from one processor to another. Thesedelays amount to a large performance degradation as number of processesgoes up that reuse the same cache lines.

SUMMARY OF THE INVENTION

The shortcomings of the prior art are overcome and additional advantagesare provided through the provision of a new instruction or instructionvariation that allows software to indicate to hardware that its storagemodification to a particular cache line is done, and will not be doingany modification for the time being

This invention, which allows software to indicate to hardware that itsstorage modification to a particular cache line is done and will not bedoing any modification for the time being, allows the system to alterits cache state. With this indication, the processor can then activelyrelease its exclusive ownership by updating its line ownership fromexclusive to read-only (or shared) in its own cache directory and in thestorage controller (SC). By actively giving up its exclusive rights, thefirst processor allows another processor to immediately be givenexclusive ownership to that cache line without waiting on anyprocessor's explicit cross invalidate acknowledgement. This inventionprovides a hardware design needed to provide this support.

After receiving such indication, a microprocessor can activelyrelinquish its exclusive ownership to a cache line, and preemptivelyupdate the ownership status in the storage controller to “shared”, thusremoving delays due to XIs that would have otherwise been encountered byanother processor should that processor request an exclusive ownershipto the cache line.

The actual microprocessor implementation involves processing theinstruction, and a new interface to communicate the “demote” request tothe storage controller. It is also important to provide necessaryinterlock to prevent a premature launch of the “demote” request. For usein a microprocessor design with a direct connection to the storagecontroller, all prior committed storage update must be done prior to theactual demote status update in both directories of the requestingprocessor and storage, but not necessarily before a demote request islaunched. For use in a microprocessor design with a private L2(Level 2cache), an alternative design is described to ensure all prior committedstorage updates are sent and are received in the storage controllerbefore the “demote” request is sent.

System and computer program products corresponding to theabove-summarized methods are also described and claimed herein.

Additional features and advantages are realized through the techniquesof the present invention. Other embodiments and aspects of the inventionare described in detail herein and are considered a part of the claimedinvention. For a better understanding of the invention with advantagesand features, refer to the description and to the drawings.

TECHNICAL EFFECTS

As a result of the summarized invention, technically we have achieved asolution which reduces the overhead of cache line sharing by multipleprocesses across a large SMP system that contains writeable data. Theoverall system wide performance can then be improved.

BRIEF DESCRIPTION OF THE DRAWINGS

The subject matter which is regarded as the invention is particularlypointed out and distinctly claimed in the claims at the conclusion ofthe specification. The foregoing and other objects, features, andadvantages of the invention are apparent from the following detaileddescription taken in conjunction with the accompanying drawings inwhich:

FIG. 1 illustrates an initial state X where processor CPy owns line Aexclusively;

FIG. 2 illustrates what happens when processor CPx needs line Aexclusively after an initial state X;

FIG. 3 illustrates CPy executes a demote to line A after an initialstate X;

FIG. 4 illustrates what happens when processor CPx needs line Aexclusively after the demote process;

FIG. 5 illustrates a demote process for a different system design havingprivate L2cache;

FIG. 6 illustrates a typical processor that is executing the demoteinstruction.

The detailed description explains the preferred embodiments of theinvention, together with advantages and features, by way of example withreference to the drawings.

DETAILED DESCRIPTION OF THE INVENTION

To allow software to indicate to the hardware a cache line is no longerrequired for further storage update, an instruction can be provided,with a way to indicate the logical address, as suited to a specificarchitecture. This is done with a new opcode or a new variation of anexisting cache management instruction using unused fields orcode-points. Specific instructions which implement this invention areexpected to be used in device drivers, operating system code or anyapplication that uses common parameter blocks or semaphore blocks.

The intention of this provision is that the software code will treatthis as a “done with store to this line” instruction, now simply called“demote instruction”, at the end of its last storage updatinginstruction. It should be used for lines that contain highly utilizeddata across various processes that are executing in different processorsand most likely at different times.

One typical software example may be on the management of a cache linethat contains various semaphore locks needed for multiprocessorhandling. The effect of the software using this provision will be toobtain or release a software lock managed in a cache line, and thendemote the line actively. By releasing the line actively, otherprocesses can proceed more quickly to either obtain or release the samelock or other locks managed within the same cache line.

An important thing is that the software application knows that this isthe last point of update until some period of time later. If thesoftware requires an update to the line soon after a “demote”, it wouldinstead be bad for performance, since then the processor will take timeto regain the exclusive rights.

Let's describe how this instruction is implemented in computer systemwith a cache hierarchy as illustrated in FIG. 1. This figure, andsubsequent FIGS. 2-5, illustrates a bi-nodal system where the StorageController (SC) is made up of 2 different physical node controllers SC0101 and SC1 102, each having 3 processors 103-105 or 106-108 attached.

FIG. 1 indicates a typical initial state where processor 103 (CPy)already owns the exclusive rights to a cache line A. FIG. 2 illustratesthat when processor 107 (CPx) requests to have exclusive rights to samecache line A, (e.g. when it is executing a “Store” instruction and needsstore access) while processing a storage update instruction, the wait ongetting a confirmation on the cross interrogate (XI) from the currentowning processor 103 (CPy) delays this requesting processor 107 (CPx)from being able to start any storage update to the line A. The steps1-10 are shown in FIG. 2.

With the provision of a “demote” instruction, instead of having to takeup the delay on the XI acknowledgement, the SCs 101 or 102 would havealready updated its directory to show that no processor is currentlyowning the line exclusively, and thus can return the line A exclusivelyto processor 107 CPx when processor 107 CPx requests for it in a verytimely manner. This is shown in FIGS. 3 and 4.

In FIG. 3, when the application running on processor 103 CPy decides to“demote” the cache line, processor 103 CPy will send a request to SC0101 to demote line A (1). (There will be a decoding and execution of aprogram instruction calling for such a demotion) Once the demote requestis received, the SC0 101 will process the request as if a “non-existing”processor is requesting line A exclusively. It will start up the lookupin its directory, send a cross interrogate to processor 103 CPy torequest a release on exclusive rights (2). If processor 103 CPy stillhave storage update to that line pending in its pipeline, it can rejectthe cross interrogate. The SC0 101 will in turn repeat the crossinterrogate until pending stores in processor 103 CPy are drained. Whenthere is no pending stores for line A existing in processor 103 CPy,processor 103 CPy at this time should naturally be accepting the releaserequest. Processor 103 CPy will update its directory with no moreexclusive rights and send back an acknowledgement to SC0 101 (3). Oncethe acknowledgement is received, the SC0 101 will update its directoryupdate to indicate that line A is now exclusive to “no one” (4). Thesoftware demote process is thus accomplished. This state of exclusive tono one is equivalent to a shared (or read-only) state with respect tohow if affect exclusive XI activities concerning this line.

Now, as seen in FIG. 4, if another processor 107 CPx requests line Aexclusively (1), the SC1 102 can quickly request the line exclusivelyfrom SC0 101 (2-4), and then reply to the requesting processor 107 CPxwith an exclusive response (5-6) without acquiring any delay for crossinterrogation towards processor 103 CPy. This reduction of delay couldbe even more apparent in a system if the Storage Controllers for nodes101, 102 are on a different chip(s) than the processors, where thecross-chip communication is now removed.

To further describe a variant implementation of this demote instruction,we will illustrate with a system where there is one private Level 2cache (L2) per processor. This is shown in FIG. 5. Each processor103-108 in this system has a private L2200.

In this design, when processor 103 CPy sends a demote request to itsprivate L2200 L2y (1), the L2will lookup its directory, and then send arelease exclusive cross interrogate back into the processor 103 CPy (2).If the Load Store Unit (LSU) inside the processor 103 CPy still hasstorage update to that line pending in its pipeline, it can reject thecross interrogate. The L2200 L2y will in turn repeat the crossinterrogate until pending stores in processor 103 CPy are drained. Whenthere is no pending stores for line A, the LSU inside the processor 103CPy will process the interrogate request, remove its directory status ofexclusive ownership, and acknowledge to L2200 L2y that this is done (3).

This private L2200 L2y will drain any pending store to this line A, thenalso update its directory to indicate no exclusive ownership (4), andsend a demote request to the SC0 101 (5). Upon receiving the demoterequest, SC0 101 will update its directory to indicate the line A is nowexclusive to “no one” (6). With this illustration, it will beappreciated that this function can be implemented with various systemshaving a different cache hierarchy or topology than that illustrated.Because these can be implemented by those skilled in the art afterlearning of this teaching, all their variants are not specificallyshown.

FIG. 6 illustrates how such an instruction is processed within amicroprocessor core. For this description, only 3 of the key units IDU301 (Instruction Dispatch Unit), FXU 302 (Fixed Point Unit), and LSU 303(Load Store Unit) are depicted as part of the microprocessor CP 300.

During hardware execution of this instruction, the microprocessorpipeline will execute this instruction as a one cycle superscalarinstruction that performs no architectural updates. All the work is tobe performed by the cache subsystem.

For an in-order microprocessor CP 300, when the “demote instruction” isdispatched from the instruction dispatch unit IDU 301, the logicaladdress calculated according to the instruction format and a decode ofsuch instruction indicating a demote operation will be sent from IDU 301to LSU 303 (arrow 1). In parallel, IDU 301 will send the opcode to FXU302 (arrow 2) which will complete the instruction if this is the next tocomplete without waiting for any acknowledgement or doing anyarchitectural update.

LSU 303 will obtain the absolute address used in cache management byeither looking up the address translation of the logical address sentfrom IDU 301 in its translation lookaside buffer (TLB) 310, or obtain atranslation result through a dynamic translation process. Once theabsolute address is obtained (arrow 4), it will arm the absolute addressand a demote command in one of its available Fetch Address Register(FAR) 312. The demote command will be a predefined interface value onthe request bus (arrow 6) to the Storage Controller (SC) indicating a“demote” is to be performed.

The LSU's 303 control logic 313 will hold on to the demote request, andwait until all prior instructions complete before it send the demoterequest and address to the SC (arrow 6). This is done by monitoringpipeline flushing interface from the FXU 302 which controls instructioncompletion in this example. It is important that the demote request isnot sent under an incorrectly predicted branch path, or if any olderinstruction does not successfully complete due to processor pipelineflushing conditions. Otherwise, an unnecessary performance penalty maybe incurred.

In an out of order microprocessor, due to the nature of the design, theactual launch of the demote request from the LSU makes use of a tag. Tofit into an out of order design, the demote request sitting in the FARregister is tagged with an instruction ID, and only launched when theglobal completion logic determines that this instruction ID is beingcompleted.

An alternative design, not specifically shown in FIG. 5 but illustratedthereby, will have the demote request be written into a store queueentry (instead of a FAR register entry) at 312. By doing so, sincestores have to be completed and processed in order for machinesrequiring a strongly-ordered memory model, the store queue logic at 312will tagged its entries with instruction IDs and receive instructioncompletion ordering from the global completion logic. The store queuelogic can then precisely send the demote request (through the FAR logic)without being premature. Additionally, any pending stores prior to thedemote instruction will naturally be drained out of its pipeline beforea demote request is sent. This helps in reducing the chance that the LSUneeds to reject the demote cross interrogate when sent by the storagecontroller, or a private L2if installed.

As illustrated, the present invention can help improve systemperformance by carefully inserting “demote” instructions in softwarecode, with a hardware provision of such mechanism. It requiresthoughtful implementation in software, firmware, together with hardwareto be effective.

The flow diagrams depicted herein are just examples. There may be manyvariations to these diagrams or the steps (or operations) describedtherein without departing from the spirit of the invention. Forinstance, the steps may be performed in a differing order, or steps maybe added, deleted or modified. All of these variations are considered apart of the claimed invention.

While the preferred embodiment to the invention has been described, itwill be understood that those skilled in the art, both now and in thefuture, may make various improvements and enhancements which fall withinthe scope of the claims which follow. These claims should be construedto maintain the proper protection for the invention first described.

What is claimed is:
 1. A computer system for relinquishing, by aselected processor, the selected processor's own exclusive ownership ofa specified cache line, the computer system comprising: a shared cachesystem; and the selected processor being a processor of amulti-processor system, each processor of the multi-processor systemcommunicatively coupled to said shared cache system, the computer systemconfigured to perform a method comprising: executing, by the selectedprocessor, a demote instruction of a software program, the demoteinstruction specifying a logical address of a specified cache line, theexecuting the demote instruction by the selected processor comprising:based on the computer system determining that the specified cache linein the shared cache system is exclusively owned by the selectedprocessor, relinquishing, by the computer system, the selectedprocessor's exclusive ownership of the cache line in the shared cachesystem.
 2. The computer system according to claim 1, wherein eachprocessor of the multi-processor system is configured to obtainexclusive ownership of cache lines of the shared cache system.
 3. Thecomputer system according to claim 2, wherein the shared cache systemcomprises a plurality of private caches, each private cache associatedwith a respective processor of the multi-processor system, wherein thespecified cache line is in a private cache associated with the selectedprocessor.
 4. The computer system according to claim 1, furthercomprising translating, by the selected processor, the logical addressto a cache address.
 5. The computer system according to claim 4, whereinthe cache address of the specified cache line is an absolute address. 6.The computer system according to claim 3, wherein execution of thedemote instruction, by the selected processor, performs no architecturalupdate.
 7. The computer system according to claim 1, wherein, based onthe executing the demote instruction, by the selected processor, theselected processor completes all pending stores to the specified cacheline before relinquishing the exclusive ownership of the cache line. 8.The computer system according to claim 1, wherein the selected processoris an out-of-order processor comprising a pipeline, wherein based on thedemote instruction being in an incorrectly predicted branch path of theselected processor, the ownership of the specified cache line is notrelinquished by the selected processor.
 9. The computer system accordingto claim 1, wherein the selected processor is an out-of-order processorcomprising a pipeline, wherein based on an instruction, older than thedemote instruction in the pipeline of the selected processor notsuccessfully completing due to pipeline flushing of the selectedprocessor, the ownership of the specified cache line is not relinquishedby the selected processor.
 10. The computer system according to claim 1,wherein the relinquishing the exclusive ownership of the specified cacheline, by the selected processor, comprises setting, by the selectedprocessor, the ownership of the specified cache line of the selectedprivate cache to any one of shared and read-only.
 11. The computersystem according to claim 1, wherein the relinquishing the exclusiveownership of the specified cache line, by the selected processor,comprises allowing another processor of the multiprocessor system toimmediately be given exclusive ownership to the specified cache linewithout waiting on any processor's explicit cross invalidateacknowledgement.
 12. The computer system according to claim 1, whereinprior to the executing the demote instruction, by the selectedprocessor, a method is performed, by the selected processor, comprising:obtaining, by the selected processor, the exclusive ownership of thespecified cache line; and performing, by the selected processor havingthe exclusive ownership of the specified cache line, a store operationto the specified cache line of the shared cache system.